home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / flex / flexs237.zoo / Makefile < prev    next >
Makefile  |  1990-06-28  |  5KB  |  191 lines

  1. # make file for "flex" tool
  2.  
  3. # @(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/Makefile,v 2.9 90/05/26 17:28:44 vern Exp $ (LBL)
  4.  
  5. # Porting considerations:
  6. #
  7. #    For System V Unix machines, add -DUSG to CFLAGS (if it's not
  8. #         automatically defined)
  9. #    For Vax/VMS, add "-DVMS -DUSG" to CFLAGS.
  10. #    For MS-DOS, add "-DMS_DOS -DUSG" to CFLAGS.  Create \tmp if not present.
  11. #         You will also want to rename flex.skel to something with a three
  12. #         character extension, change SKELETON_FILE below appropriately,
  13. #      See MSDOS.notes for more info.
  14. #    For Amiga, add "-DAMIGA -DUSG" to CFLAGS.
  15. #    For SCO Unix, add "-DSCO_UNIX" to CFLAGS.
  16. #
  17. #    For C compilers which don't know about "void", add -Dvoid=int to CFLAGS.
  18. #
  19. #    If your C compiler is ANSI standard but does not include the <stdlib.h>
  20. #    header file (some installations of gcc have this problem), then add
  21. #    -DDONT_HAVE_STDLIB_H to CFLAGS.
  22. #
  23. # By default, flex will be configured to generate 8-bit scanners only
  24. # if the -8 flag is given.  If you want it to always generate 8-bit
  25. # scanners, add "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing
  26. # so will double the size of all uncompressed scanners.
  27. # If on your system you have trouble building flex due to 8-bit
  28. # character problems, remove the -8 from FLEX_FLAGS and the
  29. # "#define FLEX_8_BIT_CHARS" from the beginning of flexdef.h.
  30.  
  31.  
  32. # the first time around use "make first_flex"
  33.  
  34.  
  35. # Installation targeting.  Files will be installed under the tree rooted
  36. # at DESTDIR.  User commands will be installed in BINDIR, library files
  37. # in LIBDIR (which will be created if necessary), auxiliary files in
  38. # AUXDIR, manual pages will be installed in MANDIR with extension MANEXT.
  39. # Raw, unformatted troff source will be installed if INSTALLMAN=man, nroff
  40. # preformatted versions will be installed if INSTALLMAN=cat.
  41. DESTDIR =
  42. BINDIR = /usr/local
  43. LIBDIR = /usr/local/lib
  44. AUXDIR = /usr/local/lib
  45. MANDIR = /usr/man/manl
  46. MANEXT = l
  47. INSTALLMAN = man
  48.  
  49. # MAKE = make
  50.  
  51.  
  52. SKELETON_FILE = $(DESTDIR)$(AUXDIR)/flex.skel
  53. SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\"
  54. CFLAGS = -O
  55. LDFLAGS = -s
  56.  
  57. COMPRESSION =
  58. FLEX_FLAGS = -ist8 -Sflex.skel
  59. # which "flex" to use to generate scan.c from scan.l
  60. FLEX = ./flex
  61. # CC = cc
  62.  
  63. AR = ar
  64. RANLIB = ranlib
  65.  
  66. FLEXOBJS = \
  67.     ccl.o \
  68.     dfa.o \
  69.     ecs.o \
  70.     gen.o \
  71.     main.o \
  72.     misc.o \
  73.     nfa.o \
  74.     parse.o \
  75.     scan.o \
  76.     sym.o \
  77.     tblcmp.o \
  78.     yylex.o
  79.  
  80. FLEX_C_SOURCES = \
  81.     ccl.c \
  82.     dfa.c \
  83.     ecs.c \
  84.     gen.c \
  85.     main.c \
  86.     misc.c \
  87.     nfa.c \
  88.     parse.c \
  89.     scan.c \
  90.     sym.c \
  91.     tblcmp.c \
  92.     yylex.c
  93.  
  94. FLEX_LIB_OBJS = \
  95.     libmain.o
  96.  
  97. FLEXLIB = flexlib.a
  98.  
  99.  
  100. all : flex $(FLEXLIB)
  101.  
  102. flex : $(FLEXOBJS)
  103.     $(CC) $(CFLAGS) -o flex $(LDFLAGS) $(FLEXOBJS)
  104.  
  105. first_flex:
  106.     cp initscan.c scan.c
  107.     $(MAKE) $(MFLAGS) flex
  108.  
  109. parse.h parse.c : parse.y
  110.     $(YACC) -d parse.y
  111.     @mv y.tab.c parse.c
  112.     @mv y.tab.h parse.h
  113.  
  114. scan.c : scan.l
  115.     $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) scan.l >scan.c
  116.  
  117. scan.o : scan.c parse.h flexdef.h
  118.  
  119. main.o : main.c flexdef.h
  120.     $(CC) $(CFLAGS) -c $(SKELFLAGS) main.c
  121.  
  122. ccl.o : ccl.c flexdef.h
  123. dfa.o : dfa.c flexdef.h
  124. ecs.o : ecs.c flexdef.h
  125. gen.o : gen.c flexdef.h
  126. misc.o : misc.c flexdef.h
  127. nfa.o : nfa.c flexdef.h
  128. parse.o : parse.c flexdef.h
  129. sym.o : sym.c flexdef.h
  130. tblcmp.o : tblcmp.c flexdef.h
  131. yylex.o : yylex.c flexdef.h
  132.  
  133. flex.man : flex.1
  134.     nroff -man flex.1 >flex.man
  135.  
  136. $(FLEXLIB) : $(FLEX_LIB_OBJS)
  137.     $(AR) cru $(FLEXLIB) $(FLEX_LIB_OBJS)
  138.  
  139. lint : $(FLEX_C_SOURCES)
  140.     lint $(FLEX_C_SOURCES) > flex.lint
  141.  
  142. distrib :
  143.     mv scan.c initscan.c
  144.     chmod 444 initscan.c
  145.     $(MAKE) $(MFLAGS) clean
  146.  
  147. install: flex $(DESTDIR)$(LIBDIR) flex.skel install.$(INSTALLMAN) install-lib
  148.     install -s -m 755 flex $(DESTDIR)$(BINDIR)/flex
  149.     install -c -m 644 flex.skel $(SKELETON_FILE)
  150.  
  151. install-lib: $(DESTDIR)$(LIBDIR) $(FLEXLIB)
  152.     install -c -m 644 $(FLEXLIB) $(DESTDIR)$(LIBDIR)/libfl.a
  153.     $(RANLIB) $(DESTDIR)$(LIBDIR)/libfl.a
  154.  
  155. $(DESTDIR)$(LIBDIR):
  156.     mkdir $@
  157.  
  158. install.man: flex.1 flexdoc.1
  159.     install -c -m 644 flex.1 $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  160.     install -c -m 644 flexdoc.1 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  161.  
  162. install.cat: flex.1 flexdoc.1
  163.     nroff -h -man flex.1 > $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  164.     nroff -h -man flexdoc.1 > $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  165.     chmod 644 $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  166.     chmod 644 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  167.  
  168. clean :
  169.     rm -f core errs flex *.o parse.c *.lint parse.h flex.man tags \
  170.         $(FLEXLIB)
  171.  
  172. tags :
  173.     ctags $(FLEX_C_SOURCES)
  174.  
  175. vms :    flex.man
  176.     $(MAKE) $(MFLAGS) distrib
  177.  
  178. test : flex
  179.     ./flex $(FLEX_FLAGS) $(COMPRESSION) scan.l | diff scan.c -
  180.  
  181. bigtest :
  182.     rm -f scan.c ; $(MAKE) COMPRESSION="-C" test
  183.     rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test
  184.     rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test
  185.     rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test
  186.     rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test
  187.     rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test
  188.     rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test
  189.     rm -f scan.c ; $(MAKE)
  190.